package stringManipulations;

public class CountCharactersInString {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String s = "Count, the number,, of commas.";  
		int numberOfCommas = s.replaceAll("[^,]","").length();
		System.out.println("Number of commas in this sentence: \n" +
				s + "\n= " + numberOfCommas);
		//System.out.println(s);
	}

}
